#include "StateFactory.h"

StateFactory::StateFactory()
{
	for (int i = 0; i < STATE_TYPE_MAX; ++i)
	{
		m_apStateList[i] = NULL;
	}
}

State* StateFactory::GetStateByType(STATE_TYPE eType)
{
	switch (eType)
	{
	case STATE_TYPE_EAT:
		if (NULL == m_apStateList[eType])
		{
			m_apStateList[eType] = new EatState;
		}
		return m_apStateList[eType];
		break;
	case STATE_TYPE_WORK:
		if (NULL == m_apStateList[eType])
		{
			m_apStateList[eType] = new WorkState;
		}
		return m_apStateList[eType];
		break;
	case STATE_TYPE_HOME:
		if (NULL == m_apStateList[eType])
		{
			m_apStateList[eType] = new HomeState;
		}
		return m_apStateList[eType];
		break;
	default:
		break;
	}

	return NULL;
}
